import axios from '@/utils/axios'

export const getRole = (id: string): Promise<ApiResult<BaseRolePO>> => {
  return axios.get(`base/role/${id}`)
}

export const getRolePage = (
  pagination: Pagination,
  params: BaseRolePO
): Promise<ApiResult<Page<BaseRolePO>>> => {
  return axios.get(`base/role/page/${pagination.page}/${pagination.pageSize}`, { params })
}

export const postOrPutRole = (data: BaseRolePO): Promise<ApiResult<null>> => {
  return axios.post(`base/role`, data)
}

export const deleteRole = (id: string): Promise<ApiResult<null>> => {
  return axios.delete(`base/role/${id}`)
}

export const getRoleList = (): Promise<ApiResult<BaseRolePO[]>> => {
  return axios.get(`base/role/list`)
}
